import type {
  MetadataConfigEntityRes,
  ProjectSearchRequest,
  ResponseBaseBody,
} from "@/interface/project";
import request from "@/utils/request";

// 查询表头配置接口
export interface QueryTableHeaderRequest {
  tableCode: string;
  scene?: string;
}

export interface TableHeaderConfig {
  id: string | number;
  name: string;
  field: string;
  type: string;
  invisible?: boolean;
  options?: Array<{
    value: string | number;
    label: string;
    tag?: string;
  }>;
  rules?: any[];
}

export interface QueryTableHeaderResponse {
  result: TableHeaderConfig[];
  total?: number;
}

/**
 * 查询表头配置
 * @param params 查询参数
 * @returns 表头配置列表
 */
export const queryTableHeader = (
  params: ProjectSearchRequest,
): Promise<ResponseBaseBody<MetadataConfigEntityRes>> => {
  return request({
    url: "/metadataConfigEntity/queryTableHeader",
    method: "POST",
    data: params,
  });
};
